# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=aspell-de
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=20161207
pkgrel=1
pkgdesc="German dictionary for aspell (mingw-w64)"
arch=('any')
url="http://aspell.net/"
license=('custom')
depends=("${MINGW_PACKAGE_PREFIX}-aspell")
source=("igerman98-${pkgver}.tar.bz2::https://j3e.de/ispell/igerman98/dict/igerman98-${pkgver}.tar.bz2"
        001-unixy-dirs.patch)
sha256sums=('17296f03c5fea62d76ecc530ebe80f6adc430278f58d472dc1842d71612960a8'
            'e96902930299fc65275fc14d8dde1d02378875382c7275bd2067cc49666f60cc')

prepare() {
  cd "${srcdir}/igerman98-${pkgver}"
}

build() {
  cd "${srcdir}/igerman98-${pkgver}"

  LANGS="de_DE de_AT de_CH"
  for l in ${LANGS}; do
    make aspell/${l}.rws
  done  
}

package() {
  cd "${srcdir}/igerman98-${pkgver}/aspell"

  install -d "${pkgdir}/${MINGW_PREFIX}/lib/aspell-0.60"

  LANGS="de_DE de_AT de_CH"
  for l in ${LANGS}; do
    install -m644 ${l}.alias ${l}.dat ${l}_affix.dat ${l}.multi ${l}.rws \
      "${pkgdir}/${MINGW_PREFIX}/lib/aspell-0.60/"
  done

  echo "add de_DE.multi" > "${pkgdir}/${MINGW_PREFIX}/lib/aspell-0.60/deutsch.alias"
  echo "add de_DE.multi" > "${pkgdir}/${MINGW_PREFIX}/lib/aspell-0.60/german.alias"
  echo "add de_CH.multi" > "${pkgdir}/${MINGW_PREFIX}/lib/aspell-0.60/swiss.alias"

}
